package com.lindroid.materialdesigndemo.statusbardemo;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.widget.Toast;

import com.lindroid.materialdesigndemo.R;
import com.lindroid.materialdesigndemo.statusbardemo.util.DeviceHelper;
import com.lindroid.materialdesigndemo.statusbardemo.util.StatusBarHelper;

import butterknife.Bind;
import butterknife.ButterKnife;

public class StatusBarActivity extends AppCompatActivity {
    @Bind(R.id.toolbar)
    Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        StatusBarHelper.translucent(this);
        setContentView(R.layout.activity_status_bar);
        ButterKnife.bind(this);

        StatusBarHelper.setStatusBarLightMode(this);
        setSupportActionBar(toolbar);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
        }

        Log.e("Tag", "状态栏高度=" + StatusBarHelper.getStatusbarHeight(this));
        Log.e("Tag", "是否是Flyme系统" + DeviceHelper.isFlyme());
        Log.e("Tag", "是否是魅族系统" + DeviceHelper.isMeizu());
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                Toast.makeText(this, "你点击了返回键", Toast.LENGTH_SHORT).show();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
